using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using AtletIS.DomainModel.Entities.Main;

namespace AtletIS.Database.Mapping.Main
{
    public class CategoryMap : EntityTypeConfiguration<Category>
    {
        public CategoryMap()
        {
            // Primary Key
            this.HasKey(t => t.ID);

            // Properties
            this.Property(t => t.Name)
                .IsRequired()
                .HasMaxLength(100);

            this.Property(t => t.AlterName)
                .HasMaxLength(100);

            this.Property(t => t.CodeName)
                .HasMaxLength(10);

            this.Property(t => t.Sex)
                .HasMaxLength(1);

            this.Property(t => t.Points)
                .HasMaxLength(100);

            // Table & Column Mappings
            this.ToTable("Categories");
            this.Property(t => t.ID).HasColumnName("ID");
            this.Property(t => t.Name).HasColumnName("Name");
            this.Property(t => t.AlterName).HasColumnName("AlterName");
            this.Property(t => t.CodeName).HasColumnName("CodeName");
            this.Property(t => t.Sex).HasColumnName("Sex");
            this.Property(t => t.YearFrom).HasColumnName("YearFrom");
            this.Property(t => t.YearTo).HasColumnName("YearTo");
            this.Property(t => t.Points).HasColumnName("Points");
            this.Property(t => t.Active).HasColumnName("Active");
            this.Property(t => t.Sync).HasColumnName("Sync");
            this.Property(t => t.WebId).HasColumnName("WebId");
            this.Property(t => t.Modified).HasColumnName("Modified");
        }
    }
}
